package commonClass.sort;

import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.Vector;

public class Arraysort {
	public void sortarray(String[] ar) {
		Arrays.sort(ar);
	}

	public void sortvector(Vector vc) {
		Collections.sort(vc);
	}

	public static void main(String[] args) {
		Arraysort ts = new Arraysort();
		String ar[] = { "thank", "you", "very", "much" };
		System.out.println("Before sort array");
		for (int i = 0; i < ar.length; i++) {
			System.out.println(ar[i]);
		}
		System.out.println("After sort array");
		ts.sortarray(ar);
		for (int i = 0; i < ar.length; i++) {
			System.out.println(ar[i]);
		}

		Vector vc = new Vector();
		vc.add("thank");
		vc.add("you");
		vc.add("very");
		vc.add("much");
		System.out.println("Before sort vector");
		for (Iterator i = vc.iterator(); i.hasNext();) {
			System.out.println(i.next().toString());
		}
		ts.sortvector(vc);
		System.out.println("After sort vector");
		for (Iterator i = vc.iterator(); i.hasNext();) {
			System.out.println(i.next().toString());
		}
	}
}
